home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Mesa-2.2 / include / GL / glx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-03  |  5.4 KB  |  239 lines

  1. /* $Id: glx.h,v 1.3 1997/02/03 19:15:42 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  2.2
  6.  * Copyright (C) 1995-1997  Brian Paul
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25.  * $Log: glx.h,v $
  26.  * Revision 1.3  1997/02/03 19:15:42  brianp
  27.  * conditionally include glx_mangle.h
  28.  *
  29.  * Revision 1.2  1996/09/19 03:50:42  brianp
  30.  * added glXReleaseBuffersMESA(), GLX_MESA_release_buffers extension
  31.  *
  32.  * Revision 1.1  1996/09/13 01:26:41  brianp
  33.  * Initial revision
  34.  *
  35.  */
  36.  
  37.  
  38. #ifndef GLX_H
  39. #define GLX_H
  40.  
  41.  
  42. /*
  43.  * A pseudo-GLX implementation to allow GLX-based OpenGL programs to
  44.  * work with Mesa.
  45.  *
  46.  * Notes:
  47.  *   1. If the visual passed to glXGetConfig was not one returned by
  48.  *      glXChooseVisual then the GLX_RGBA and GLX_DOUBLEBUFFER queries
  49.  *      will always return True and the GLX_DEPTH_SIZE query will always
  50.  *      return non-zero.
  51.  *   2. The glXIsDirect() function always returns True.
  52.  */
  53.  
  54.  
  55.  
  56. #include <X11/Xlib.h>
  57. #include <X11/Xutil.h>
  58. #include "GL/gl.h"
  59. #ifdef MESA
  60. #include "GL/xmesa.h"
  61. #endif
  62.  
  63.  
  64. #if defined(USE_MGL_NAMESPACE)
  65. #include "glx_mangle.h"
  66. #endif
  67.  
  68.  
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif
  72.  
  73.  
  74. #define GLX_VERSION_1_1        1
  75.  
  76.  
  77. /*
  78.  * Tokens for glXChooseVisual and glXGetConfig:
  79.  */
  80. enum _GLX_CONFIGS {
  81.     GLX_USE_GL        = 1,
  82.     GLX_BUFFER_SIZE        = 2,
  83.     GLX_LEVEL        = 3,
  84.     GLX_RGBA        = 4,
  85.     GLX_DOUBLEBUFFER    = 5, 
  86.     GLX_STEREO        = 6,
  87.     GLX_AUX_BUFFERS        = 7,
  88.     GLX_RED_SIZE        = 8,
  89.     GLX_GREEN_SIZE        = 9,
  90.     GLX_BLUE_SIZE        = 10,
  91.     GLX_ALPHA_SIZE        = 11,
  92.     GLX_DEPTH_SIZE        = 12,
  93.     GLX_STENCIL_SIZE    = 13,
  94.     GLX_ACCUM_RED_SIZE    = 14,
  95.     GLX_ACCUM_GREEN_SIZE    = 15,
  96.     GLX_ACCUM_BLUE_SIZE    = 16,
  97.     GLX_ACCUM_ALPHA_SIZE    = 17,
  98.  
  99.     /* GLX_EXT_visual_info extension */
  100.     GLX_X_VISUAL_TYPE_EXT        = 0x22,
  101.     GLX_TRANSPARENT_TYPE_EXT    = 0x23,
  102.     GLX_TRANSPARENT_INDEX_VALUE_EXT    = 0x24,
  103.     GLX_TRANSPARENT_RED_VALUE_EXT    = 0x25,
  104.     GLX_TRANSPARENT_GREEN_VALUE_EXT    = 0x26,
  105.     GLX_TRANSPARENT_BLUE_VALUE_EXT    = 0x27,
  106.     GLX_TRANSPARENT_ALPHA_VALUE_EXT    = 0x28
  107. };
  108.  
  109.  
  110. /*
  111.  * Error codes returned by glXGetConfig:
  112.  */
  113. #define GLX_BAD_SCREEN        1
  114. #define GLX_BAD_ATTRIBUTE    2
  115. #define GLX_NO_EXTENSION    3
  116. #define GLX_BAD_VISUAL        4
  117. #define GLX_BAD_CONTEXT        5
  118. #define GLX_BAD_VALUE           6
  119. #define GLX_BAD_ENUM        7
  120.  
  121.  
  122. /*
  123.  * GLX 1.1 and later:
  124.  */
  125. #define GLX_VENDOR        1
  126. #define GLX_VERSION        2
  127. #define GLX_EXTENSIONS         3
  128.  
  129.  
  130. /*
  131.  * GLX_visual_info extension
  132.  */
  133. #define GLX_TRUE_COLOR_EXT        0x8002
  134. #define GLX_DIRECT_COLOR_EXT        0x8003
  135. #define GLX_PSEUDO_COLOR_EXT        0x8004
  136. #define GLX_STATIC_COLOR_EXT        0x8005
  137. #define GLX_GRAY_SCALE_EXT        0x8006
  138. #define GLX_STATIC_GRAY_EXT        0x8007
  139. #define GLX_NONE_EXT            0x8000
  140. #define GLX_TRANSPARENT_RGB_EXT        0x8008
  141. #define GLX_TRANSPARENT_INDEX_EXT    0x8009
  142.  
  143.  
  144. /*
  145.  * Compile-time extension tests
  146.  */
  147. #ifdef MESA
  148. #define GLX_EXT_visual_info        1
  149. #define GLX_MESA_pixmap_colormap    1
  150. #define GLX_MESA_release_buffers    1
  151. #endif
  152.  
  153.  
  154.  
  155. #ifdef MESA
  156.    typedef XMesaContext GLXContext;
  157.    typedef Pixmap GLXPixmap;
  158.    typedef Drawable GLXDrawable;
  159. #else
  160.    typedef void * GLXContext;
  161.    typedef XID GLXPixmap;
  162.    typedef XID GLXDrawable;
  163. #endif
  164. typedef XID GLXContextID;
  165.  
  166.  
  167.  
  168. extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
  169.                      int *attribList );
  170.  
  171. extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
  172.                     GLXContext shareList, Bool direct );
  173.  
  174. extern void glXDestroyContext( Display *dpy, GLXContext ctx );
  175.  
  176. extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
  177.                 GLXContext ctx);
  178.  
  179. extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
  180.                 GLuint mask );
  181.  
  182. extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
  183.  
  184. extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
  185.                      Pixmap pixmap );
  186.  
  187. extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
  188.  
  189. extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
  190.  
  191. extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
  192.  
  193. extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
  194.  
  195. extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
  196.              int attrib, int *value );
  197.  
  198. extern GLXContext glXGetCurrentContext( void );
  199.  
  200. extern GLXDrawable glXGetCurrentDrawable( void );
  201.  
  202. extern void glXWaitGL( void );
  203.  
  204. extern void glXWaitX( void );
  205.  
  206. extern void glXUseXFont( Font font, int first, int count, int list );
  207.  
  208.  
  209.  
  210. /* GLX 1.1 and later */
  211. extern const char *glXQueryExtensionsString( Display *dpy, int screen );
  212.  
  213. extern const char *glXQueryServerString( Display *dpy, int screen, int name );
  214.  
  215. extern const char *glXGetClientString( Display *dpy, int name );
  216.  
  217.  
  218.  
  219. /*
  220.  * Mesa GLX Extensions
  221.  */
  222.  
  223. #ifdef GLX_MESA_pixmap_colormap
  224. extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
  225.                                          Pixmap pixmap, Colormap cmap );
  226. #endif
  227.  
  228. #ifdef GLX_MESA_release_buffers
  229. extern Bool glXReleaseBuffersMESA( Display *dpy, Window w );
  230. #endif
  231.  
  232.  
  233.  
  234. #ifdef __cplusplus
  235. }
  236. #endif
  237.  
  238. #endif
  239.